package org.monitoringtools.agents;

import java.lang.management.ManagementFactory;

import javax.management.MBeanServer;
import javax.management.ObjectName;

import org.monitoringtools.managedbeans.impl.Monitoring;

public class MonitoringAgent {

    private MBeanServer server = null;

    public MonitoringAgent() {

        server = ManagementFactory.getPlatformMBeanServer();

        Monitoring tBean = new Monitoring();
        ObjectName tBeanName = null;

        try {
            tBeanName = new ObjectName("MonitoringAgent:type=Monitoring");
            server.registerMBean(tBean, tBeanName);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
